package com.thinkgem.jeesite.common.wechat.utils;

import com.thinkgem.jeesite.common.wechat.constants.Constants;

import net.sf.json.JSONObject;

public class MMenu {

    // 创建菜单地址
    public static String CREATE_URL = "https://qyapi.weixin.qq.com/cgi-bin/menu/create?access_token=ACCESS_TOKEN&agentid=AGENTID";

    //删除菜单地址
    public static String DELETE_URL = "https://qyapi.weixin.qq.com/cgi-bin/menu/delete?access_token=ACCESS_TOKEN&agentid=AGENTID";
    
    //获取菜单列表地址
    public static String GETMENU_URL = "https://qyapi.weixin.qq.com/cgi-bin/menu/get?access_token=ACCESS_TOKEN&agentid=AGENTID";
    
    // 示例
    public static void main(String[] args) {
         String access_token = WeixinUtil.getAccessToken(Constants.CORPID, Constants.SECRETA).getToken();
         System.out.println(access_token);
         
         GETMENU_URL = GETMENU_URL.replace("ACCESS_TOKEN", access_token).replace("AGENTID","0");
         JSONObject jsonObject = WeixinUtil.HttpRequest(GETMENU_URL, "GET", null);
         //请求成功
         if(null != jsonObject){
             System.out.println(jsonObject.toString());
         }
    }
}
